package StudyCode.summary.textfile;

import java.io.DataOutput;
import java.io.IOException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class WriteFixedStringToDataOutput {

	public static void writeFixedString(DataOutput out, int length, String s)
			throws IOException {
		for (int i = 0; i < length; i++) {
			if (i < s.length())
				out.writeChar(s.charAt(i));
			else
				out.writeChar(0);
		}
	}
}